#include "flightsegmentwidget.h"
#include "ui_flightsegmentwidget.h"


namespace Ui {
    class FlightSegmentWidget;
}

FlightSegmentWidget::FlightSegmentWidget(QWidget* parent) :
    QWidget(parent),
    ui(new Ui::FlightSegmentWidget)
{
    ui->setupUi(this);
    //this->setStyleSheet("background-color: lightblue;");
    this->setStyleSheet("background-color: white;");
    //this->setStyleSheet("background-color: #F0F0F0; border: 1px solid #A9A9A9; border-radius: 5px;");
}

FlightSegmentWidget::~FlightSegmentWidget() {
    delete ui;
}

void FlightSegmentWidget::setFlightNumber(const QString& flightNumber) {
    ui->flightNumberLabel->setText(flightNumber);
}

void FlightSegmentWidget::setAirline(const QString& airline) {
    ui->airlineLabel->setText(airline);
}

void FlightSegmentWidget::setDepartureAirport(const QString& departureAirport) {
    ui->departureAirportLabel->setText(departureAirport);
}

void FlightSegmentWidget::setArrivalAirport(const QString& arrivalAirport) {
    ui->arrivalAirportLabel->setText(arrivalAirport);
}

void FlightSegmentWidget::setDepartureTime(const QString& departureTime) {
    ui->departureTimeLabel->setText(departureTime);
}

void FlightSegmentWidget::setArrivalTime(const QString& arrivalTime) {
    ui->arrivalTimeLabel->setText(arrivalTime);
}

void FlightSegmentWidget::setPrice(double price) {
    ui->priceLabel->setText(QString::number(price, 'f', 2)+"元");
}

void FlightSegmentWidget::setTotalTime(const QString& totalTime) {
    ui->totalTimeLabel->setText(totalTime);
}

void FlightSegmentWidget::setIsTransfer(bool isTransfer) {
    /*if (isTransfer) {
        ui->isTransferLabel->setText("Transfer: Yes");
    } else {
        ui->isTransferLabel->setText("Transfer: No");
    }*/
}
